<?php 
    //session_start();
    //ob_start();
    require_once('../../../Connections/ocmanmanager.php');
    require_once('../../../Connections/checkuser.php'); 
?>

<?php
$nameissueid = "-1";
if (isset($_GET['id'])) {
  $nameissueid = $_GET['id'];
}
   //this is the id from issue form. (issuetable).
   $id_issue = $nameissueid;
    
    
    // entry code (add notes)- - -  create error handller.
    if(isset($_POST['save'])){   
    mysql_select_db($database_ocmanmanager, $ocmanmanager);// selecting database.
    $notes = $_POST['notes']; 
    $notetitle= $_POST['notetitle'];
    $issueid = $id_issue;
    $dateadded = date("Y-d-m");
    $addedby = "1";
    $important = "0";
    $deleted = "0";
    
    // run sqlquery of inserting data from the tables (notes).
    
    $query_add_notes = "INSERT INTO issuenotes(notetitle,notes,issueid,dateadded,addedby,important,deleted) VALUE ('$notetitle','$notes','$issueid','$dateadded','$addedby','$important','$deleted')";
    $mysql_result = mysql_query($query_add_notes); 
    header("Location:issue.php?id='$id_issue'");
        /*echo '<script>';        
        echo 'alert("data has been added")';
        echo '</script>'; 
        // java script for pop up menu.*/
    }
?>

<!DOCTYPE html>
<html>
	<head>
		<title>Ozcrete Mobile</title> 
            <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
        	<link rel="stylesheet" href="css/jquery.mobile.css" />
        	<link rel="stylesheet" href="css/jquery.mobile.splitview.css" />
            <link rel="stylesheet"  href="css/jquery.mobile.grids.collapsible.css" />
          <script type="text/javascript" src="js/jquery-1.7.1.js"></script>
          <script type="text/javascript" src="js/jquery.mobile.splitview.js"></script>
          <script type="text/javascript" src="js/jquery.mobile.js"></script>
          <script type="text/javascript" src="js/iscroll-wrapper.js"></script>
          <script type="text/javascript" src="js/iscroll.js"></script>
          <script type="text/javascript">
            
          </script>
          <!--script type="text/javascript" src="scrollability.js"></script-->
	</head>
    
<body>
    <div data-role="page" id="add_notes">
    <div data-role="header" data-backbtn="false">
          <h1>Adding notes</h1>
    </div>
<form action="#" method="post">
<table border="0" style="width: 99%;">
   
    <tr>
        <td colspan="2" align="left">Adding of Notes</td>
    </tr>
    <tr>
        <td height="100px"></td>
    </tr>
    <tr>
        <td width="100px"></td>
        <td style="font-family: !important; font-size:14px" align="left">Note Title:</td>
        <td width="100px"></td>
    </tr>
    <tr>
        <td></td>
        <td><div align="left"><input type="text" name="notetitle"  placeholder="note title"/></div></td>
    </tr>" style="font-style: italic;"/></div></td>
    </tr>
    <tr>
        <td></td>
        <td style="font-family: !important; font-size:14px">Notes:</td>
    </tr>
    <tr>
        <td></td>
        <td><div align="left"><textarea type="textarea" name="notes" id="notes"  placeholder="add notes" style="width: 100%; height: 100px;" ></textarea></div></td>
    </tr>
    <tr>
        <td></td>
        <td style="font-family: !important; font-size:14px">Next Action:</td>
    </tr>
    <tr>
        <td></td>
        <td><div align="left"><input type="text" name="nextaction[]"  placeholder="next action"/></div></td>
    </tr>
    <tr>
        <td></td>
        <td style="font-family: !important; font-size:14px">Assigned to:</td>
    </tr>
    <tr>
        <td></td>
        <td><div align="center"><input type="text" name="assignedto[]"  placeholder="assigned to"/></div></td>
    </tr>
    <tr>
        <td></td>
        <td style="font-family: !important; font-size:14px">To be done by:</td>
    </tr>
    <tr>
        <td></td>
        <td><div align="left"><input type="text" name="tobedoneby[]"  placeholder="to be done by"/></div></td>
    </tr>
    <tr>
        <td height="20px"></td>
    </tr>
    <tr>   
        <td colspan="3">
         <div class="ui-body ui-body-b">
         <fieldset class="ui-grid-a">
         <div class="ui-block-a"><button type="submit" name="cancel" data-theme="d">Cancel</button></div>
         <div class="ui-block-b" align="right"><button type="submit" name="save" data-theme="a">Submit</button></div>
         </fieldset>
         </div>
        </td>
    </tr>
</table>
</form>
</div>
</body>